def bubble_sort(arr):
    n = len(arr)
    for i in range(n - 1):
        swapped = False
        for j in range(n - i - 1):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]
                swapped = True
        if not swapped:
            break
    return arr


if __name__ == "__main__":
    import json

    # 读取测试数据并填充预期结果
    with open("test_cases.json") as f:
        data = json.load(f)

    for case in data.values():
        case["expected"] = sorted(case["original"])

    with open("test_cases.json", "w") as f:
        json.dump(data, f, indent=2)
